package com.woniuxy.intellihome.provider;

import com.woniuxy.intellihome.entity.Region;
import org.apache.ibatis.jdbc.SQL;

public class RegionProvider {

    public String select(Region region) {
        return new SQL() {{
            SELECT("*");
            FROM("m_region");
            if (region.getPid() != null) {
                WHERE("pid ='" + region.getPid() + "'");
            }
            if (region.getPid() == null) {
                WHERE("pid is null");
            }

        }}.toString();
    }
}